package com.guanyu.u2cache.caffeine;

import com.github.benmanes.caffeine.cache.Expiry;
import lombok.NonNull;
import org.checkerframework.checker.index.qual.NonNegative;

/**
 * @author zhouyunjian
 * @date 2023/11/15 10:15
 **/
public class CaffeineExpiry implements Expiry<String, Object> {
    @Override
    public long expireAfterCreate(@NonNull String key, @NonNull Object value, long currentTime) {
        return 0;
    }

    @Override
    public long expireAfterUpdate(@NonNull String key, @NonNull Object value, long currentTime, @NonNegative long currentDuration) {
        return currentDuration;
    }

    @Override
    public long expireAfterRead(@NonNull String key, @NonNull Object value, long currentTime, @NonNegative long currentDuration) {
        return currentDuration;
    }
}
